import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import "./commit.css"; //清除默认的样式
import App from "./App"; //最大的爸爸
import * as serviceWorker from "./serviceWorker";
import "antd-mobile/dist/antd-mobile.css";
import store from "./store/index";
import { Provider } from "react-redux";
//设置商品详情跳转路由
import {
  BrowserRouter as Router,
  Route,
  Link,
  Redirect,
  Switch
} from "react-router-dom";
import ProductDetail from "./components/productsDetail/productDetail";

ReactDOM.render(
  <Provider store={store}>
    <Router>
      <Switch>
        <Route path="/home" component={App} />
        <Route path="/detail" component={ProductDetail} />
        <Redirect from="/" to="/home" />
      </Switch>
    </Router>
  </Provider>,

  document.getElementById("root")
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
